package com.wanmait.community.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanmait.community.entity.BeforeRepairPic;
import com.wanmait.community.mapper.AdminRepairMapper;
import com.wanmait.community.mapper.BeforeRepairPicMapper;
import com.wanmait.community.service.BeforeRepairPicService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class BeforeRepairPicServiceImpl extends ServiceImpl<BeforeRepairPicMapper, BeforeRepairPic> implements BeforeRepairPicService{
    @Resource
    private AdminRepairMapper adminRepairMapper;
    @Resource
    private BeforeRepairPicMapper beforeRepairPicMapper;
    @Override
    public List<BeforeRepairPic> findAllList() {
        return beforeRepairPicMapper.selectList(null);
    }
    @Override
    public void insertBeforeRepairPic(BeforeRepairPic beforeRepairPic) {
        beforeRepairPicMapper.insertBeforeRepairPic(beforeRepairPic);//250418，before_repair_pic的creat_by与admin_pepair的creat_by无关，可以不是一个人
    }
    @Override
    public BeforeRepairPic findBRPByAdminRepairId(Integer id) {//根据adminRepairId查单个BRP对象
        return beforeRepairPicMapper.findBRPByAdminRepairId(id);
    }
    //业主修改报修记录还要改维修前的图片
    @Override
    public void updateBeforeRepairPicByAdminRepairId(BeforeRepairPic beforeRepairPic) {
        beforeRepairPicMapper.updateBeforeRepairPicByAdminRepairId(beforeRepairPic);
    }
    @Override
    public void deleteBeforeRepairPicByAdminRepairId(Integer id) {//逻辑删除
        beforeRepairPicMapper.deleteBeforeRepairPicByAdminRepairId(id);
    }
}
